Skip to main content

Recommendation

View Recommendation

Once the consultation is fulfilled and the recommendation is done by the doctor, the recommendation data will be available and included in the ConsultationType data.

Using getConsultationInfo with the consultation ID, you can view the recommendation data:

import { getConsultationInfo } from 'react-web-altibbi';

const response = await getConsultationInfo(123);
// response.data.recommendation will contain the recommendation data

Here is an example of the recommendation data structure:

const recommendation = {
id: 1,
consultation_id: 123,
created_at: 'date',
updated_at: 'date',
data: {
lab: {
lab: [
{ name: "lab_name" },
// ...
],
panel: [
{ name: "panel_name" },
// ...
],
},
drug: {
fdaDrug: [
{
name: 'name',
dosage: 'dosage',
duration: 10, // Days
howToUse: 'how_to_use',
frequency: 'frequency',
tradeName: 'trade_name',
dosageForm: 'dosage_form',
dosageUnit: 'dosage_unit',
packageSize: 'package_size',
packageType: 'package_type',
strengthValue: 'strength_value',
relationWithFood: 'relation_with_food',
specialInstructions: 'special_instructions',
routeOfAdministration: 'route_of_administration',
registrationNumber: 'registration_number',
},
// ...
],
},
icd10: {
symptom: [
{
code: 'symptom_code',
name: 'symptom_name',
},
// ...
],
diagnosis: [
{
code: 'diagnosis_code',
name: 'diagnosis_name',
},
// ...
],
},
followUp: [
{ name: 'follow_up_name' },
// ...
],
doctorReferral: {
name: 'referral_name',
},
postCallAnswer: [
{
answer: 'post_call_answer',
question: 'post_call_question',
},
],
},
};

Download Prescription

You can get the prescription by using getPrescription with the consultation_id.

On web, getPrescription returns the raw fetch Response object (instead of a decoded object as in the React Native SDK). Convert it to a Blob and trigger a download using an object URL.

Check the code below that includes using getPrescription and saving/downloading the PDF file in the browser:

import { getPrescription } from 'react-web-altibbi';

async function downloadPrescription(consultationId: number) {
const response = await getPrescription(consultationId);
const blob = await response.blob();
const url = URL.createObjectURL(blob);

const link = document.createElement('a');
link.href = url;
link.download = `prescription-${Date.now()}.pdf`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
}